/*
-------------------------------------------------------------------
BIE is Copyright 2001-2004 Brunswick Corp.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/bie_license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------

*/
package tests.jd;

/*
 * regex.java
 *
 * Created on May 29, 2002, 10:01 AM
 */
import java.util.regex.*;
import java.io.*;
import java.util.*;
import java.net.*;


/**
 *
 * @author  jdepons
 * @version 
 */
public class regex {

    /** Creates new regex */
    public regex() {
    }

    /**
    * @param args the command line arguments
    */
    public static void main (String args[]) throws Exception{

        
    //URI uri = new URI("dasf hello/hey");
    //System.out.println("scheme = " + uri.getScheme());
        /*
    String physicalName = "htp://hey";
    Matcher matcher = Pattern.compile("^(http) | (hTtp) | hTTp | Http)://").matcher(physicalName);
            
     if (matcher.find()) {
         System.out.println("found - " + matcher.group(1));            
     }else {
         System.out.println("done");
     }
    */
    
        /*
        String physicalName = "hello to you ^heyHey$ you are ^what up_- 2$ the man";
        Matcher matcher = Pattern.compile("(\\^[a-zA-Z1-9\\s_-]+\\$)").matcher(physicalName);
        
        while (matcher.find()) {
            System.out.println("found - " + matcher.group(1));            
        }                      
        
        */
    
        /*    
        String inputStr = "ftp://ftp.domain.com:2020";        
        String patternStr = "(ftp://)*([\\w._]+)(:(\\d*))*(.*)";
    
        // Compile and use regular expression
        Pattern pattern = Pattern.compile(patternStr);
        Matcher matcher = pattern.matcher(inputStr);
        boolean matchFound = matcher.find();
    
        if (matchFound) {
            // Get all groups for this match
            for (int i=0; i<=matcher.groupCount(); i++) {
                String groupStr = matcher.group(i);
                System.out.println("str = " + groupStr);
            }
        }
*/    
  /*      
        String fname = "\\/fs_m234323423424";

        String patternStr = "(\\W*)([^_^\\.]+)";

        // Compile and use regular expression
        Pattern pattern = Pattern.compile(patternStr);
        Matcher matcher = pattern.matcher(fname);
        boolean matchFound = matcher.find();

        if (!matchFound) {
            System.out.println("match not found");;
        }

        String routeKey = "";
        System.out.println(matcher.group(1));        
        System.out.println(matcher.group(2));        
*/        
        
       /* 
            String fileName = "/fs_m1023360957536";
            
            String patternStr = "(\\W*)([^_^\\.]+)";

            // Compile and use regular expression
            Pattern pattern = Pattern.compile(patternStr);
            Matcher matcher = pattern.matcher(fileName);
            
            boolean matchFound = matcher.find();

            
                String routeKey = "";
                routeKey = matcher.group(2);        
                System.out.println(matcher.group(1));
                System.out.println(matcher.group(2));
       */
        
        //String dest = "ftp://wd-012:4500/hello/goodbye";
        
        //String patternStr = "(ftp://)*([\\w\\.\\-_]+)(:(\\d*))*(.*)";
    
        //Matcher matcher = Pattern.compile("^(http://)*([\\w\\.\\-_]+)(:(\\d*))*(.*)$").matcher("http://wd-012:4500/hello/goodbye");
        //if (!matcher.find()) {
        //    throw Excepiton("Could not match");
        //}
        
                
        // Compile and use regular expression
       // Pattern pattern = Pattern.compile(patternStr);
       // Matcher matcher = pattern.matcher(dest);
        //boolean matchFound = matcher.find();
                                      
        //System.out.println(matcher.group(2));
        //System.out.println(matcher.group(5));
       /*
            Matcher m = Pattern.compile("[\\? | &]id=(\\d+)").matcher("803/view/editUser.bie&id=223");
            
            //if not found it is a user create
            if (!m.find()) {
                System.out.println("not found");
            }
        
            System.out.println("group 2 = " + m.group(1));
        */
       /* 
            Matcher m = Pattern.compile("^([^\\.]+)(.*)$").matcher("file.txt.bie");
            
            if (!m.find()) {
                System.out.println("not found");
                return;
            }
            
            System.out.println("group 1 = " + m.group(1));
            System.out.println("group 2 = " + m.group(2));

            System.out.println("file = " + m.group(1) + "2342342342" + m.group(2));
        */
        
//        Matcher matcher = Pattern.compile("^(http://)(([^@]*)@)?([\\w\\.\\-_]+)(:(\\d*))?(.*)").matcher(httpValue);
/*        
        String url = "http://bob:jones@scorpion.wdi.com/hello";
        Matcher matcher = Pattern.compile("^http://([^:]+):([^@]+)@.+").matcher(url);
        if (matcher.find()) {
           String username = matcher.group(1);
           String password = matcher.group(2);           
           System.out.println("username = " + username);
           System.out.println("password = " + password);
        }else {
            System.out.println("not found");
        }
    }
*/
        /*
        String physicalName = "/hello/FTP_ROOT/goodbye/myfile";
        Matcher matcher = Pattern.compile("\\/FTP_ROOT\\/([^\\/]+)\\/(.*)").matcher(physicalName);
        if (matcher.find()) {
            System.out.println("1 = " + matcher.group(1));
            System.out.println("2 = " + matcher.group(2));
        }else {
            System.out.println("not found");
        }
        */

        //ReplaceExpression repex = new ReplaceExpression();
        //String sep = File.separator;
        
        //repex.fileReplace("/root/mytest.txt + "/bin/stop.bat","\\$BIE_JAVA_HOME\\$",biehomeDir + sep + "jre" + sep + "bin");
    
    /*
        String to = "/root/bie/dist";
        String from = "/root/bie5_2_1/bie/dist";
                
        File f = new File("/root/changes.out");
        
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
        String line = "Only in /root/bie/dist/bin: Wrapper.dll";

        ArrayList addedList = new ArrayList();
        ArrayList changedList = new ArrayList();
        ArrayList removedList = new ArrayList();
        
        while ((line = br.readLine()) != null) {
            
            Matcher added = Pattern.compile("Only\\sin\\s" + to + "(.*):\\s(.*)").matcher(line);
        
            Matcher changed = Pattern.compile("Files\\s" + from + "(.*)\\sand\\s" + to + ".*").matcher(line);

            Matcher removed = Pattern.compile("Only\\sin\\s" + from + "(.*):\\s(.*)").matcher(line);
            
            if (added.find()) {
                addedList.add(added.group(1) + "/" + added.group(2));                
            }else if (changed.find()) {
                changedList.add(changed.group(1));
            }else if (removed.find()) {
                addedList.add(removed.group(1) + "/" + removed.group(2));                
                
            }else {
                System.out.println("Could not categorize: " + line);
            }
                
        }
        
        System.out.println("Added Files");
        Iterator it = addedList.iterator();
        while (it.hasNext()) {
            String fname = (String) it.next();
            System.out.println("al.add(\"" + fname + "\");");
        }
        
        System.out.println("Removed Files");
        it = removedList.iterator();
        while (it.hasNext()) {
            String fname = (String) it.next();
            System.out.println("al.add(\"" + fname + "\");");
        }

        System.out.println("Changed Files");
        it = changedList.iterator();
        while (it.hasNext()) {
            String fname = (String) it.next();
            System.out.println("al.add(\"" + fname + "\");");
        }
      */  
        
        /*
        Only in /root/bie/dist/bin: Wrapper.dll
        Only in /root/bie/dist/bin: Wrapper.exe
        Files /root/bie5_2_1/bie/dist/chains/JonesPubPO.bpml and /root/bie/dist/chains/JonesPubPO.bpml differ
        Only in /root/bie/dist/conf: datasources.xml
        Files /root/bie5_2_1/bie/dist/conf/extensions.xml and /root/bie/dist/conf/extensions.xml differ
        Only in /root/bie/dist/conf: wrapper.conf
        Files /root/bie5_2_1/bie/dist/docs/CHANGES and /root/bie/dist/docs/CHANGES differ
Files /root/bie5_2_1/bie/dist/lib/bie.jar and /root/bie/dist/lib/bie.jar differ
Only in /root/bie/dist/lib: kunststoff.jar
Only in /root/bie/dist/lib: wrapper.jar
Files /root/bie5_2_1/bie/dist/map.xsd and /root/bie/dist/map.xsd differ
Files /root/bie5_2_1/bie/dist/services/webserver/conf/server.xml and /root/bie/dist/services/webserver/conf/server.xml differ
Files /root/bie5_2_1/bie/dist/services/webserver/conf/web.xml and /root/bie/dist/services/webserver/conf/web.xml differ
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity: activityFormFooter.jsp
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity: activityFormHeader.jsp
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/addAction.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/addAction.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/bieWSView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/bieWSView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/builder.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/builder.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/confirm.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/confirm.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/fileReadView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/fileReadView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/fileWriteView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/fileWriteView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/ftpGetView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/ftpGetView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/ftpPutView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/ftpPutView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/identityTransformView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/identityTransformView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/inboxGetView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/inboxGetView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/inboxPutView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/inboxPutView.jsp differ
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity: regexList.jsp
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/requestDataForm.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/requestDataForm.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/runCommandView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/runCommandView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/sendMailView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/sendMailView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/sqlReadView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/sqlReadView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/sqlWriteView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/sqlWriteView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/transactionLoggerView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/transactionLoggerView.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/activity/translationView.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/activity/translationView.jsp differ
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view: commands.jsp
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/dashboardTop.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/dashboardTop.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/datasource.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/datasource.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/datasourceList.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/datasourceList.jsp differ
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view: editCommand.jsp
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view: editDatasource.jsp
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/groups.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/groups.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/home.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/home.jsp differ
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view: listener
Only in /root/bie/dist/services/webserver/context/dashboard/BIE/view: manageCommandResources.jsp
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/notification.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/notification.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/poplistener.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/poplistener.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/sbieUsersConf.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/sbieUsersConf.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/showSchema.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/showSchema.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/view/system.jsp and /root/bie/dist/services/webserver/context/dashboard/BIE/view/system.jsp differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/WEB-INF/server-config.wsdd and /root/bie/dist/services/webserver/context/dashboard/BIE/WEB-INF/server-config.wsdd differ
Files /root/bie5_2_1/bie/dist/services/webserver/context/dashboard/BIE/WEB-INF/web.xml and /root/bie/dist/services/webserver/context/dashboard/BIE/WEB-INF/web.xml differ
Files /root/bie5_2_1/bie/dist/util/create.sql and /root/bie/dist/util/create.sql differ
Files /root/bie5_2_1/bie/dist/util/drop.sql and /root/bie/dist/util/drop.sql differ
Only in /root/bie/dist/util: Upgrade5_3_0.sql        
     */   
    }
}
